<template>
<div>
  <h1>供应商管理</h1>
  <div style="width: 600px;height: 300px;margin:0 auto;box-shadow: 0 2px 12px 0 rgba(0,0,0,0.5);">
    <div style="display: flex;flex-direction: column;">
      <div class="di" style="margin: 50px">
        <span style="margin-right: 20px">账号</span>
        <el-input v-model="username" aria-placeholder="用户名" style="width: 150px">{{
            username
          }}
        </el-input>
      </div>
      <div class="di" style="margin: 25px">
        <span style="margin-right: 20px">密码</span>
        <el-input v-model=" password" aria-placeholder="密码" style="width: 150px" type="password">{{
            password
          }}
        </el-input>
      </div>
      <div class="di">
        <el-button type="success" @click="login">登录</el-button>
        <el-button type="success" @click="register">注册</el-button>
      </div>
    </div>
  </div>
</div>
</template>

<script>
export default {
  name: "LoginView",
  data(){
    return{
      username:"",
      password:""
    }
  },
  mounted() {
  },
  methods:{
    login(){
      this.$axios.get("/psc/sys-user/login/"+this.username+"/"+this.password).then(
          r=>{
            console.log(r.data)
            if (r.data!=""){
              this.$router.push("GoodsView")
              sessionStorage.setItem("userNumber",r.data.usernumber)
              sessionStorage.setItem("userName",r.data.username)

            }else {
              this.$message.error("登陆失败")
            }

          }
      )
    },
    register(){
      this.$router.push("RegisterView")
    }
  }
}
</script>

<style scoped>
.text {
  font-size: 14px;
}

.item {
  padding: 18px 0;
}

.box-card {
  width: 480px;
}

</style>